package com.ruijie.acl.web;

import java.util.List;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;

import com.ruijie.acl.AccessGroup;
import com.ruijie.acl.service.AccessGroupService;
import com.ruijie.foundation.bo.EntityObject;
import com.ruijie.foundation.service.Repository;

/**
 * <p>
 * Title: ACL设备中规则比对管理Action类

 * </p>
 * <p>
 * Description:
 * </p>
 * <p>
 * 为ACL设备中规则比对管理模块提供页面数据的显示、获取和页面的跳转。

 * </p>
 * <p>
 * Copyright: Copyright (c) 2008
 * </p>
 * <p>
 * Company: Ruijie Co., Ltd.
 * </p>
 * <p>
 * Create Time: 
 * </p>
 * <p>
 * </p>
 * <p>
 * Update Time:
 * </p>
 * <p>
 * Updater:
 * </p>
 * <p>
 * Update Comments:
 * </p>
 * @author ASAI
 */
@Name("contrastGroupAction")
@Scope(ScopeType.CONVERSATION)
public class ContrastGroupAction extends AclBaseAction{

	@In("#{accessGroupService}")
	private AccessGroupService accessGroupService;
	
	private AccessGroup model;
	
	private AccessGroup sysModel;
	
	private AccessGroup devModel;
	
	public String doContrast(String name,Long id) {
		
		List<AccessGroup> list = accessGroupService.getAccessGroupByName(name);
		for(AccessGroup group : list) {
			if(group.getAclDevice() == null) {
				sysModel = group;
			}else {
				if(group.getAclDevice().getId().equals(id)){
					devModel = group;
				}
			}
		} 
		return getDetailPage();
	}
	
	@Override
	@SuppressWarnings("unchecked")
	protected Repository getRepository() {
		return accessGroupService;
	}

	@Override
	protected String getAddPage() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public EntityObject getCriteria() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	protected String getDetailPage() {
		return "/acl/components/contrastGroup.seam";
	}

	@Override
	protected String getListPage() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public EntityObject getModel() {
		return model;
	}

	@Override
	protected String getUpdatePage() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void resetModel() {
		this.model = null;
		model = new AccessGroup();
	}

	@Override
	public void setCriteria(EntityObject criteria) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void setModel(EntityObject model) {
		this.model = (AccessGroup) model;
	}

	public AccessGroup getSysModel() {
		return sysModel;
	}

	public void setSysModel(AccessGroup sysModel) {
		this.sysModel = sysModel;
	}

	public AccessGroup getDevModel() {
		return devModel;
	}

	public void setDevModel(AccessGroup devModel) {
		this.devModel = devModel;
	}

}
